package com.foodplus.www.model.impl;

import com.foodplus.www.api.RetrofitManager;
import com.foodplus.www.bean.login.CodeBean;
import com.foodplus.www.bean.login.LoginBean;
import com.foodplus.www.model.IloginModel;

import java.util.Map;

import rx.Subscriber;
import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;

/**
 * Created by WangZhiChao on 2016/11/1.
 */

public class LoginModelImpl implements IloginModel {
    @Override
    public void getLoginCode(Subscriber<CodeBean> subscriber, Map<String, String> params) {
        RetrofitManager
                .getInstance()
                .getLoginService()
                .getCode(params)
                .observeOn(AndroidSchedulers.mainThread())
                .subscribeOn(Schedulers.io())
                .subscribe(subscriber);
    }

    @Override
    public void GetLoginResult(Subscriber<LoginBean> subscriber, Map<String, String> params) {
        RetrofitManager
                .getInstance()
                .getLoginService()
                .Login(params)
                .observeOn(AndroidSchedulers.mainThread())
                .subscribeOn(Schedulers.io())
                .subscribe(subscriber);
    }


}
